﻿using System;
using System.Collections.Generic;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CubicFWNet.Common;

namespace CubicFWNet.Data.Models.Mapping
{
    public class EquipmentMap : EntityTypeConfiguration<Equipment>
    {
        public EquipmentMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.EquipmentName)
                .IsRequired()
                .HasMaxLength(64);

            // Table & Column Mappings
            this.ToTable("Equipment");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.EquipmentName).HasColumnName("EquipmentName");
            this.Property(t => t.OperateWork).HasColumnName("OperateWork");
            this.Property(t => t.TestWork).HasColumnName("TestWork");
            this.Property(t => t.ToolWork).HasColumnName("ToolWork");
            this.Property(t => t.ManageWork).HasColumnName("ManageWork").HasPrecision(18, 8);
            this.Property(t => t.SalesWork).HasColumnName("SalesWork").HasPrecision(18, 8);
        }
    }
}
